package com.ruoyi.front.service.impl;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.front.domain.Work;
import com.ruoyi.front.dto.WorkDTO;
import com.ruoyi.front.mapper.WorkInfoMapper;
import com.ruoyi.front.mapper.WorkMapper;
import com.ruoyi.front.service.WorkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WorkServiceImpl implements WorkService {
    @Autowired
    private WorkMapper workMapper;
    @Autowired
    private WorkInfoMapper workInfoMapper;
    @Override
    public R add(WorkDTO workDTO) {
        System.out.println("workDTO = " + workDTO);
        workMapper.add(workDTO);
        workInfoMapper.add(workDTO);
        return R.ok(null,"作品提交成功");
    }

    @Override
    public R getWorkById(Integer id) {
        WorkDTO info = workMapper.getInfoById(id);
        return R.ok(info,"获取作品数据成功");
    }
}
